package com.springboot.springboot4.exeception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;


/**
 * @ClassName:
 * @author: CKC
 * @DateTime: 2021/1/21 12:55
 *
 * 处理整个Web controller 异常
 *
 */
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {
    //处理异常
    
    @ExceptionHandler({ArithmeticException.class,NullPointerException.class })
    public String handlerArithException(Exception e){
    
        log.error("异常是：{}", e);
        return "login";
        //视图地址
    }
}
